Micron Document
🎖️GitЯра🎖️

Node / meshtastic / Meshtastic-Android / files / core / ui / src / commonMain / kotlin / org / meshtastic / core / ui / util / SnackbarManager.kt

Displaying Raw • Download

core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/util/SnackbarManager.kt 7a0915ebe99a4704e871fa5711964def956af182 (7a0915eb) Text, 2.36 KB

T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.ui.util

Tff7b72import T7ee787androidx.compose.material3.SnackbarDuration
Tff7b72import T7ee787kotlinx.coroutines.channels.Channel
Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787kotlinx.coroutines.flow.receiveAsFlow
Tff7b72import T7ee787org.koin.core.annotation.Single

T8b949e/**
* A global manager for displaying snackbars across the application. This allows ViewModels to trigger transient
* feedback messages without direct dependencies on UI components or `SnackbarHostState`.
*
* Events are buffered in a [Channel] and consumed exactly once by the host composable via `MeshtasticSnackbarHost`.
*
* @see AlertManager for the modal dialog equivalent.
*/
Tf0883e@Single
Tff7b72open Tff7b72class T56d364SnackbarManager Tb4b4b4{
Tff7b72data Tff7b72class T56d364SnackbarEventTb4b4b4(
Tff7b72val Te6edf3messageTb4b4b4: Tffa657StringTb4b4b4,
Tff7b72val Te6edf3actionLabelTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
Tff7b72val Te6edf3withDismissActionTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Tff7b72val Te6edf3durationTb4b4b4: Te6edf3SnackbarDuration Tff7b72= Te6edf3SnackbarDurationTb4b4b4.Te6edf3ShortTb4b4b4,
Tff7b72val Te6edf3onActionTb4b4b4: Tb4b4b4(Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tff7b72? Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4)

Tff7b72private Tff7b72val Te6edf3_events Tff7b72= Te6edf3ChannelTff7b72<Te6edf3SnackbarEventTff7b72>Tb4b4b4(Te6edf3ChannelTb4b4b4.Te6edf3BUFFEREDTb4b4b4)
Tff7b72open Tff7b72val Te6edf3eventsTb4b4b4: Te6edf3FlowTff7b72<Te6edf3SnackbarEventTff7b72> Tff7b72= Te6edf3_eventsTb4b4b4.Te6edf3receiveAsFlowTb4b4b4(Tb4b4b4)

Tff7b72open Tff7b72fun Td2a8ffshowSnackbarTb4b4b4(
Te6edf3messageTb4b4b4: Tffa657StringTb4b4b4,
Te6edf3actionLabelTb4b4b4: Tffa657String? Tff7b72= Tff7b72nullTb4b4b4,
Te6edf3withDismissActionTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3durationTb4b4b4: Te6edf3SnackbarDuration Tff7b72= Tff7b72if Tb4b4b4(Te6edf3actionLabel Tff7b72!Tff7b72= Tff7b72nullTb4b4b4) Te6edf3SnackbarDurationTb4b4b4.Te6edf3Indefinite Tff7b72else Te6edf3SnackbarDurationTb4b4b4.Te6edf3ShortTb4b4b4,
Te6edf3onActionTb4b4b4: Tb4b4b4(Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4)Tff7b72? Tff7b72= Tff7b72nullTb4b4b4,
Tb4b4b4) Tb4b4b4{
Te6edf3_eventsTb4b4b4.Te6edf3trySendTb4b4b4(
Te6edf3SnackbarEventTb4b4b4(
Te6edf3message Tff7b72= Te6edf3messageTb4b4b4,
Te6edf3actionLabel Tff7b72= Te6edf3actionLabelTb4b4b4,
Te6edf3withDismissAction Tff7b72= Te6edf3withDismissActionTb4b4b4,
Te6edf3duration Tff7b72= Te6edf3durationTb4b4b4,
Te6edf3onAction Tff7b72= Te6edf3onActionTb4b4b4,
Tb4b4b4)Tb4b4b4,
Tb4b4b4)
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s